﻿using System;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000013 RID: 19
	[Serializable]
	public class ConstraintRotationOffset : Constraint
	{
		// Token: 0x06000146 RID: 326 RVA: 0x00002F33 File Offset: 0x00001133
		public ConstraintRotationOffset()
		{
		}

		// Token: 0x06000147 RID: 327 RVA: 0x00002F3B File Offset: 0x0000113B
		public ConstraintRotationOffset(Transform transform)
		{
			this.transform = transform;
		}

		// Token: 0x06000148 RID: 328 RVA: 0x0001EB90 File Offset: 0x0001CD90
		public override void UpdateConstraint()
		{
			if (this.weight <= 0f)
			{
				return;
			}
			if (!base.isValid)
			{
				return;
			}
			if (!this.initiated)
			{
				this.defaultLocalRotation = this.transform.localRotation;
				this.lastLocalRotation = this.transform.localRotation;
				this.initiated = true;
			}
			if (this.rotationChanged)
			{
				this.defaultLocalRotation = this.transform.localRotation;
			}
			this.transform.localRotation = this.defaultLocalRotation;
			this.transform.rotation = Quaternion.Slerp(this.transform.rotation, this.offset, this.weight);
			this.lastLocalRotation = this.transform.localRotation;
		}

		// Token: 0x1700000B RID: 11
		// (get) Token: 0x06000149 RID: 329 RVA: 0x00002F62 File Offset: 0x00001162
		public bool rotationChanged
		{
			get
			{
				return this.transform.localRotation != this.lastLocalRotation;
			}
		}

		// Token: 0x0400008D RID: 141
		public Quaternion offset;

		// Token: 0x0400008E RID: 142
		public Quaternion defaultRotation;

		// Token: 0x0400008F RID: 143
		public Quaternion defaultLocalRotation;

		// Token: 0x04000090 RID: 144
		public Quaternion lastLocalRotation;

		// Token: 0x04000091 RID: 145
		public Quaternion defaultTargetLocalRotation;

		// Token: 0x04000092 RID: 146
		public bool initiated;
	}
}
